<template>
	<!-- 登录 -->
	<view class="content">
		<view class="avatorWrapper">
			<view class="avator">
				<image class="img" src="../../static/OIP-C.png" mode="widthFix"></image>
			</view>
		</view>
		<view class="form">
			<view class="inputWrapper">
				<input class="input" type="text" v-model="form.customerCode" placeholder="请输入用户名"/>
			</view>
			<view class="inputWrapper">
				<input class="input" type="password" v-model="form.passWord" placeholder="请输入密码"/>
			</view>
			<view class="loginBtn">
				<text class="btnValue" @click="login">登录</text>
			</view>
			<view class="forgotBtn">
				<text @click="zh">找回密码</text>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				title: 'hello',
				form: {
					customerCode: '',
					passWord: '',
				}

			}
		},
		onLoad() {

		},
		methods: {
			login() {
				
				uni.request({
					url: 'http://localhost:8081/serviceedu/login/CustomerLogin',
					method: 'POST',
					data: this.form,
					success: (res) => {
						console.log(res)
						if (res.data.code == 20000) {
							uni.setStorageSync("token", res.data.data.token)
							console.log("登录成功")
							// uni.switchTab({
							// 	url:'./contact'
							// })
							//关闭所有页面，打开到应用内的某个页面。
							uni.reLaunch({
								url: './contact'
							})
						} else {

							console.log("登录失败！")
						}
					}
				})

			},
			zh() {
				uni.switchTab({
					url: './contact'
				})
			}
		}
	}
</script>

<style>
	.contentt {
		background: #377EB4;
		width: 100vw;
		height: 100vh;
	}

	.avatorWrapper {
		height: 30vh;
		width: 100Vw;
		display: flex;
		justify-content: center;
		align-items: flex-end;
	}

	.avator {
		width: 200upx;
		height: 200upx;
		overflow: hidden;
	}

	.avator .img {
		width: 100%;
		border-radius: 50%;
		overflow: hidden;
	}

	.form {
		padding: θ 100upx;
		margin-top: 30px;
		justify-content: center;
	}

	.inputWrapper {
		width: 100%;
		height: 80upx;
		background: white;
		border-radius: 20px;
		box-sizing: border-box;
		padding: 0 20px;
		margin-top: 30px;
		justify-content: center;
		align-items: center;
	}

	.input {
		width: 100%;
		height: 100%;

		font-size: 15px;
	}

	.loginBtn {
		width: 100%;
		height: 80upx;
		background: #77B307;
		border-radius: 59upx;
		margin-top: 50px;
		display: flex;
		justify-content: center;
		align-items:
			center;
	}

	.iogintn.btrvalue {
		color: white;
	}

	.forgotBtn {
		text-align: center;
		color: #EAF6F9;
		justify-content: center;
		font-size: 15px;
		margin-top: 10px;
	}

	page {
		background-color: #146617;
	}
</style>
